package com.jeeplus.modules.web.service;

import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.web.entity.YjMahjongHallWaiters;
import com.jeeplus.modules.web.mapper.YjMahjongHallWaitersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 棋牌室服务生Service
 * @author liangbing
 * @version 2021-03-13
 */
@Service
@Transactional(readOnly = true)
public class YjMahjongHallWaitersService extends CrudService<YjMahjongHallWaitersMapper, YjMahjongHallWaiters> {
    @Autowired
    YjMahjongHallWaitersMapper mapper;

    public YjMahjongHallWaiters get(String id) {
        return super.get(id);
    }

    /**
     * 获得同一手机号的服务生列表
     * @param mobile 手机号
     * @return 服务生列表
     */
    public List<YjMahjongHallWaiters> findByMobile(String mobile) {
        return mapper.findByMobile(mobile, DataEntity.DEL_FLAG_NORMAL);
    }

    /**
     * 获得棋牌室的服务生列表
     * @param hallId 棋牌室id
     * @return 服务生列表
     */
    public List<YjMahjongHallWaiters> findByHallId(String hallId) {
        return mapper.findByHallId(hallId, DataEntity.DEL_FLAG_NORMAL);
    }

    /**
     * 获得有效的(接收呼叫语音推送的)棋牌室的服务生列表
     * @param hallId 棋牌室id
     * @return 有效的服务生列表
     */
    public List<YjMahjongHallWaiters> findEffectiveByHallId(String hallId) {
        return mapper.findEffectiveByHallId(hallId, DataEntity.DEL_FLAG_NORMAL);
    }

    /**
     * 获得正在工作中的服务生列表
     * @param hallId 棋牌室id
     * @return 正在工作中的服务生列表
     */
    public List<YjMahjongHallWaiters> findInWorkWaitersByHallId(String hallId) {
        return mapper.findInWorkWaitersByHallId(hallId, DataEntity.DEL_FLAG_NORMAL);
    }

    public List<YjMahjongHallWaiters> findList(YjMahjongHallWaiters yjMahjongHallWaiters) {
        return super.findList(yjMahjongHallWaiters);
    }

    public Page<YjMahjongHallWaiters> findPage(Page<YjMahjongHallWaiters> page, YjMahjongHallWaiters yjMahjongHallWaiters) {
        return super.findPage(page, yjMahjongHallWaiters);
    }

    @Transactional(readOnly = false)
    public void save(YjMahjongHallWaiters yjMahjongHallWaiters) {
        super.save(yjMahjongHallWaiters);
    }

    @Transactional(readOnly = false)
    public void delete(YjMahjongHallWaiters yjMahjongHallWaiters) {
        super.delete(yjMahjongHallWaiters);
    }

    @Transactional(readOnly = false)
    public void deleteWaiter(String hallWaiterId) {
        mapper.deleteWaiter(hallWaiterId);
    }

    @Transactional(readOnly = false)
    public void updateByMobile(YjMahjongHallWaiters yjMahjongHallWaiters) {
        mapper.updateByMobile(yjMahjongHallWaiters);
    }

}
